#include "hal_i2c.h"

struct hal_i2c_if *i2c_if = &g_hdl_i2c_if;

int8_t hal_i2c_init(void)
{
	return i2c_if->i2c_init(I2C1);
}

int8_t hal_i2c_write(I2C_Type *base,uint8_t dev_addr,uint8_t reg_addr,uint8_t *w_buf,uint8_t len)
{
	return i2c_if->i2c_write(base,dev_addr,reg_addr,w_buf,len);
}

int8_t hal_i2c_read(I2C_Type *base,uint8_t dev_addr,uint8_t reg_addr,uint8_t *w_buf,uint8_t len)
{
	return i2c_if->i2c_read(base,dev_addr,reg_addr,w_buf,len);
}

int8_t hal_i2c_analog_init(void)
{
	return i2c_if->i2c_analog_init();
}

int8_t hal_i2c_analog_start(void)
{
	return i2c_if->i2c_analog_start();
}

int8_t hal_i2c_analog_stop(void)
{
	return i2c_if->i2c_analog_stop();
}

int8_t hal_i2c_analog_wait_ack(void)
{
	return i2c_if->i2c_analog_wait_ack();
}

int8_t hal_i2c_analog_write(uint8_t dat)
{
	return i2c_if->i2c_analog_write(dat);
}
